var stepId = $CertusJsonAjax.getStepInstanceId();
var processId = $CertusJsonAjax.getProInstanceId();
function showType(code) {
    var type="";
    if (code==1){
        type="年假及病事假";
    }else if (code==4){
        type="档假";
    }else if (code==5){
        type="婚假";
    }else if (code==6){
        type="产检假";
    }else if (code==7){
        type="产假";
    }else if (code==8){
        type="陪产假";
    }else if (code==9){
        type="哺乳假";
    }else if (code==10){
        type="节育假";
    }else if (code==11){
        type="丧假";
    }else if (code==12){
        type="工伤假";
    }
    return type;
}

$CertusFormAjax.ajax("findVtlists",{"processId":processId}, function(result){
    var data = result.data;
    $$scope.vacationType = showType(data.vacationType);
    $$scope.createUser = data.createUser;
    $$scope.beginTime = data.beginTime;
    $$scope.start = data.start;
    $$scope.endTime = data.endTime;
    $$scope.end = data.end;
    $$scope.vacationDay = data.vacationDay;
    $$scope.totalHour = data.totalHour;
    $$scope.telephone = data.telephone;
    $$scope.comments = data.comments;
    $$scope.opinionMsg = data.opinionMsg;
    $$scope.id = data.id;
});
$(".agree").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    // 开启
    var index = layer.load(1);
    $CertusFormAjax.ajax('agree',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        //关闭
        layer.close(index);
        layer.msg("审批成功");
        window.history.back();
    });
});

$(".rback").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    $CertusFormAjax.ajax('rback',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        layer.msg("退回成功");
        window.history.back();
    });
});

$(".unagree").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    $CertusFormAjax.ajax('unagreeQjlc',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        layer.msg("审批成功");
        window.history.back();
    });
})